package com.vf.admin.client.dao;

import com.vf.admin.common.db.BaseDao;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.GameZpRecord;
import com.vf.admin.utils.StringEx;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 大转盘奖励表
 */
@Repository
public class AppGameZpRecordDao extends BaseDao<GameZpRecord> {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    /**
     * 保存或者更新
     */
    public void save(GameZpRecord zpRecord) {
        if (zpRecord.getId() != null && zpRecord.getId() > 0) {
            this.update(zpRecord);
        } else {
            zpRecord.setId(this.add(zpRecord));
        }
    }

    //列表查询
    public List<GameZpRecord> findList(Integer userid, SplitPageBean splitPage) {
        List<Object> paramList = new ArrayList<Object>();
        StringBuilder sbStr = new StringBuilder("SELECT * FROM game_zp_record WHERE 1=1");
        sbStr.append(" and userid = ? ");
        paramList.add(userid);
        sbStr.append(" order by createtime desc ");
        String sql = sbStr.toString();
        return this.queryList(sql, paramList, GameZpRecord.class, splitPage);
    }


}
